package com.dundun.SSO.manage.impl;

import com.dundun.SSO.core.impl.BaseServiceImpl;
import com.dundun.SSO.manage.ISsoRolePermissionRelationService;
import com.dundun.SSO.manage.dao.SsoRoleSsoPermissionRelationDao;
import com.dundun.SSO.manage.pojo.SsoRolePermissionRelation;
import com.dundun.SSO.manage.query.SsoRolePermissionRelationQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**********************************************************
 * 版权所有：搜影科技 保留所有权利
 * 创建日期: 2017/5/6 0006 17:50
 * 创建作者: gezhangkai
 * 版    本:
 * 功    能:
 * 最后修改时间:
 * 修改记录:
 ***********************************************************/
@Service
public class SsoRolePermissionRelationServiceImpl extends BaseServiceImpl<SsoRolePermissionRelation> implements ISsoRolePermissionRelationService {

    @Autowired
    private SsoRoleSsoPermissionRelationDao ssoRoleRightRelationDao;

    public List<SsoRolePermissionRelation> selectByPage(SsoRolePermissionRelationQuery ssoRoleRightRelationQuery) {
        return ssoRoleRightRelationDao.selectByPage(ssoRoleRightRelationQuery);
    }

    public Integer selectCountByPage(SsoRolePermissionRelationQuery ssoRoleRightRelationQuery) {
        return ssoRoleRightRelationDao.selectCountByPage(ssoRoleRightRelationQuery);
    }

    @Override
    public List<SsoRolePermissionRelation> selectAllPermissionRelationByRoleId(Long id) {
        Example example = new Example(SsoRolePermissionRelation.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("roleId",id);
        return selectByExample(example);
    }
}
